package com.lc.hongtai.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 4/5/2016.
 */
@HttpInlet("common/reg")
public class JsonReg extends HYAsyPost<JsonReg.RegistBackInfo> {

    public String access_token, txtPhone, txtPwd , txtIncode, realname,  idcard;

    public JsonReg(String access_token, String txtPhone, String txtPwd, String txtIncode, String realname, String idcard, AsyCallBack<RegistBackInfo> asyCallBack) {
        super(asyCallBack);

        this.access_token = access_token;

        this.txtPhone = txtPhone;
        this.txtPwd = txtPwd;
        this.realname = realname;
        this.txtIncode = txtIncode;
        this.idcard = idcard;

    }

    @Override
    protected RegistBackInfo parser(JSONObject object) {

        TOAST = object.optString("tips");
        
        if (object.optString("status").equals("1")) {

            TOAST = "注册成功";

            RegistBackInfo registBackInfo = new RegistBackInfo();

            registBackInfo.uid = object.optString("uid");
            registBackInfo.url = object.optString("url");
            registBackInfo.status = object.optString("status");
            return registBackInfo;

        }

        return null;
    }

    public static class RegistBackInfo{

        public String uid, url,status;
    }

//    {
//        "status": "1",
//            "uid": "275",
//            "url": "http:\/\/vhost106.zihaistar.com\/wap\/fuyou\/web_reg\/uid\/275.html"
//    }

}
